<!DOCTYPE html>
<html>
	<head>
		<!-- <link href="QQQ.css" rel="stylesheet" type="text/css" /> -->
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css"></style>
	</head>

	<body>

		<a href="https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener#Example" target="_blank">addEventListener的详细解读</a>

		<table id="outside">
		    <tr><td id="t1">one</td></tr>
		    <tr><td id="t2">two</td></tr>
		</table>

	</body>

	<script type="text/javascript">
		/*等待网页加载完毕*/
		window.onload = function() {

			// 改变t2的函数
			function modifyText() {
			  var t2 = document.getElementById("t2");
			  if (t2.firstChild.nodeValue == "three"){
			      t2.firstChild.nodeValue = "two";
			  }else{
			      t2.firstChild.nodeValue = "three";
			  }
			}

			// 为table添加事件监听器
			var el = document.getElementById("outside");
			el.addEventListener("click", modifyText, false);
		}
	</script>
</html>